package com.hison.tandainbao.controller;

import com.hison.tandainbao.entiy.pojo.domain.TbBlogComments;
import com.hison.tandainbao.response.ResponseResult;
import com.hison.tandainbao.service.TbBlogCommentsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName: BlogCommentsController
 * @Descripiton: 博客评论控制类
 * @Author: 小郑
 * @Date： 2024/3/31 21:56
 * @Version：1.8
 **/
@RequestMapping("/BlogComment")
@Api(value = "博客评论",tags = "博客评论")
@RestController
public class BlogCommentsController {


    @Autowired
    private TbBlogCommentsService tbBlogCommentsService;


    //TODO 展示评论
    @GetMapping("/getComments")
    @ApiOperation(value = "根据博客ID获取评论",produces = "application/json",httpMethod = "GET")
    public ResponseResult getComments(@RequestParam("BlogID") String blogID){
        return  tbBlogCommentsService.getComments(blogID);
    }

    /**
     * 删除评论
     *
     * @param commentId 注释 ID
     * @return @return {@code ResponseResult }
     * @author $USER$
     * @date 2024/03/31
     * @see String
     * @see ResponseResult
     * @since version
     */
    @DeleteMapping("/delComment/{BlogID}")
    @ApiOperation(value="删除评论",produces = "application/json",httpMethod = "DELETE")
    public  ResponseResult  delComment(@RequestParam("commentId") String commentId){
        return  tbBlogCommentsService.deleteComment(commentId);
    }


    //点赞评论
    @PutMapping("/likedComments/{id}")
    @ApiOperation(value = "点赞评论",produces = "application/json",httpMethod = "PUT")
    public  ResponseResult likeComment(@PathVariable("id") String commentId ){
        return  tbBlogCommentsService.likeComment(commentId);
    }


    //TODO 回复评论













}